﻿using Quartz;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using JinJun.YShowReception.Core;

namespace JinJun.YShowReception.JobScheduler.Job
{
    public class BackupJob : IJob
    {
        public async Task Execute(IJobExecutionContext context)
        {
            //备份数据库
            string dbName = ConfigurationHelper.GetAppSettingsValue("TableName");
            string filename = ConfigurationHelper.GetAppSettingsValue("BackupPath")+"_"+dbName+".bak";           
            //if (!System.IO.File.Exists(filename))
            //{
            //    System.IO.File.Create(filename);
            //}
            //调用备份数据库方法
            DatabaseMaintenance.Backup(filename,dbName);
            await Task.Delay(1);
        }
    }
}
